package com.southwind.springboottest.controller;

import com.southwind.springboottest.entity.User;
import com.southwind.springboottest.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserHandler {
    @Autowired
    private UserRepository use;

    //通过id的值可以查到他的其他数据信息
    @GetMapping("/findById/{id}")
    public User findById(@PathVariable("id") Integer id){
        return use.findById(id).get();
    }

}
